Macromedia Central Development Quick Start Guide
Table of Contents
Developing Your First Application
Here are the steps to develop your first Central application.
Step 1. Create a New FLA
You can either create one from scratch or use the Central authoring templates that you installed in Step 4 on the previous page.
- Flash MX 2004: File > New > Templates > Macromedia Central > Central Application
- Flash MX: File > New From Template > Macromedia Central > Central Application
Step 2. Set the Frames Per Second
Set the frames per second for your application to 21 fps. This is the same rate at which Central runs.
Select the stage and choose Window > Properties > Frame Rate. If you used the authoring templates, you do not need to do this step.
Step 3. Set Up the Publish Settings
If you used the Flash MX 2004 authoring template, you can skip this step. Otherwise, make the following settings for whichever version of Flash you use:
-
Flash MX: File > Publish Settings > Flash
Version: Flash Player 6
Omit Trace Actions: Unchecked
Debugging Permitted: Unchecked
Compress Movie: Checked -
Flash MX 2004: File > Publish Settings > Flash
Version: Flash Player 6
ActionScript Version: ActionScript 1.0 (2.0 also works)
Omit Trace Actions: Unchecked
Debugging Permitted: Unchecked
Compress Movie: Checked
Optimize for Flash Player 6r65: Checked
Step 4. Add ActionScript to Your Application
You are now ready to add the bare code that's necessary for your application to run within Central. If you used the Flash MX 2004 authoring template, the stub ActionScript code is already inserted in your file.
Create a new layer on the Timeline and name it Actions. With the first frame selected, open the ActionScript editor:
- Flash MX 2004: Window > Development Panels > Actions
- Flash MX: Window > Actions
Add the following ActionScript code:
onActivate = function(shell, appID, shellID, baseTabIndex, initialData)
{
//initialization code goes here
shell.setStatus("Loaded");
}
onDeactivate = function()
{
//clean up code goes here
}
Central.initApplication(this, this);
The onActivate function is called when your application
is loaded into Central; it should contain any initialization code for
your application. The onDeactivate function is called
when your application is about to be closed; it should contain any
cleanup code, such as closing connections with the server, clearing
intervals, and _global variables.
Finally, Central.initApplication() tells Central that
the application is ready to be run. After this method is called, Central
calls your onActivate function.
Note that the shell.setStatus method in the onActivate function
sets the text within the Central status bar.
Step 5. Add a Graphic to the Stage
Create a new layer and add a graphic or shape to the Stage. This is temporary; it's only needed to provide a visual indication that your application has loaded into Central.
Step 6. Publish the Application
You are now ready to create the SWF file for the application. To do this, publish the file by selecting File > Publish.
If you get any ActionScript errors, correct them. Once the file has been published, there will be a SWF file in the same folder as the FLA. This is the application that you will next install into Central.